//
//  JTDatePicker.m
//  JiongTu
//
//  Created by 杨璟 on 16/3/21.
//  Copyright © 2016年 YSKJ. All rights reserved.
//

#import "JTDatePicker.h"

@implementation JTDatePicker
/**
 *  单例对象的全局变量
 */
static JTDatePicker *_instance;

/**
 *  返回单例对象
 */
+ (instancetype)sharedPicker {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _instance = [[self alloc] init];
        _instance.datePickerMode = UIDatePickerModeDate;
        _instance.minimumDate = [NSDate date];
        _instance.maximumDate = [[NSDate alloc] initWithTimeIntervalSinceNow:7*24*60*60];
    });
    return _instance;

}

/**
 *  重写单例对象的alloc方法
 */
+ (instancetype)allocWithZone:(struct _NSZone *)zone {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _instance = [super allocWithZone:zone];
    });
    return _instance;
}

/**
 *  重写单例对象的copy方法
 */
+ (instancetype)copyWithZone:(struct _NSZone *)zone {
    return _instance;
}
@end
